package com.space.jwt.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @标题：swagger-ui配置
 * @描述：
 * @包名：com.space.jwt.config
 * @项目名：springboot-jwt
 * @公司：
 * @创建者：space
 * @修改者：space
 * @创建日期： 2019-03-06 15:49
 * @修改日期： 2019-03-06 15:49
 * @版本：1.0
 */
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.space.jwt.api"))
                .paths(PathSelectors.any())
                .build();
    }
    @Bean
    public Docket createaaRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("实时监测")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.space.jwt.api"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Springboot-jwt RESTful APIs")
                .description("Springboot-jwt 接口文档")
                .termsOfServiceUrl("http://localhost:9000/")
                .contact("qkk_space@sina.com")
                .version("1.0")
                .build();
    }
}
